package data.request
{
	import data.events.RequestBaseEvent;
	
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.net.URLRequestMethod;
	import flash.net.URLVariables;
	
	public class RequestBase
	{
		private var _urlLoader:URLLoader;
		private var _request:URLRequest;
		private var _vars:URLVariables;
//		private var _isComplete:Boolean;
//		private var _isSucceed:Boolean;
		private var _loadCount:int;
		
		/**
		 *数据包根级编号 
		 */		
		private var _rootPackCode:int;
		
		/**
		 *数据包子级编号 
		 */		
		private var _packCode:int;
		
		public function RequestBase(url:String, vars:Object, methodType:String)
		{
			_urlLoader=new URLLoader();
			_request=new URLRequest();
			_vars=URLVariables(vars);
			
			_request.url=url;
			_request.method=methodType;
			_request.data=_vars;
		}

//		/**
//		 * 是否加载完成 
//		 */		
//		public function get isComplete():Boolean
//		{
//			return _isComplete;
//		}
//
//		/**
//		 * 是否加载完成 
//		 */		
//		public function set isComplete(value:Boolean):void
//		{
//			_isComplete = value;
//		}
		
//		/**
//		 *是否加载成功 
//		 */		
//		public function get isSucceed():Boolean
//		{
//			return _isSucceed;
//		}
//		
//		/**
//		 *是否加载成功 
//		 */	
//		public function set isSucceed(value:Boolean):void
//		{
//			_isSucceed = value;
//		}

		public function get urlLoader():URLLoader
		{
			return _urlLoader;
		}

		public function set urlLoader(value:URLLoader):void
		{
			_urlLoader = value;
		}

		public function get request():URLRequest
		{
			return _request;
		}

		public function set request(value:URLRequest):void
		{
			_request = value;
		}

		public function get loadCount():int
		{
			return _loadCount;
		}

		public function set loadCount(value:int):void
		{
			_loadCount = value;
		}

		/**
		 *数据包根级编号 
		 */
		public function get rootPackCode():int
		{
			return _rootPackCode;
		}
		
		/**
		 *数据包根级编号 
		 */
		public function set rootPackCode(value:int):void
		{
			_rootPackCode=value;
		}
		
		/**
		 * 数据包子级编号 
		 */
		public function get packCode():int
		{
			return _packCode;
		}
		
		/**
		 *数据包子级编号 
		 */
		public function set packCode(value:int):void
		{
			_packCode=value;
		}
		
		/**
		 *资源释放 
		 */		
		public function dispose():void
		{
			_vars=null;
			_request=null;
			_urlLoader=null;
		}
	}
}